<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/9/16
 * Time: 10:59
 */

namespace app\common\validate;


use think\Validate;

class SysRole extends Validate
{
    protected $rule = [ // 定义验证规则
        'role_id|角色ID' => 'require|gt:1',
        'role_name|角色名称' => 'require|unique:SysRole,role_name',
    ];

    protected $message = [ // 定义验证提示
        'role_id.gt'=>'该角色不能修改'
    ];

    protected $scene = [ // 定义验证场景
        'add' => ['role_name'],
        'update' => ['role_id','role_name.unique'=>'SysRole,role_name^role_id'],
    ];
}